import { TGuildConfig } from "../../../Message/Db/Tables/TGuildConfig";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
type int = number;
//class GuildConfig
    
    export  class GuildConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (GuildConfig._instance != null) 
            {
                throw new Error(" GuildConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TGuildConfig();
                loc1.level = loc2.level;
                loc1.deputyNum = loc2.deputyNum;
                loc1.presbyterNum = loc2.presbyterNum;
                loc1.eliteNum = loc2.eliteNum;
                loc1.maxNum = loc2.maxNum;
                loc1.maxMoney = loc2.maxMoney;
                loc1.maxResource = loc2.maxResource;
                loc1.updateBloom = loc2.updateBloom;
                loc1.updateMoney = loc2.updateMoney;
                loc1.updateResource = loc2.updateResource;
                this._map[loc1.level] = loc1;
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_guild_config.json");
            this.write(loc1);
            return;
        }

        public getConfigByLevel(arg1: int): TGuildConfig
        {
            return this._map[arg1];
        }

        public getMaxNumByLevel(arg1: int): int
        {
            var loc1=this._map[arg1];
            if (loc1) 
            {
                return loc1.maxNum;
            }
            return 0;
        }

        public static get instance(): GuildConfig
        {
            if (GuildConfig._instance == null) 
            {
                GuildConfig._instance = new GuildConfig();
            }
            return GuildConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: GuildConfig;
    }
